<?php

namespace Common\Taglib;

class answer
{
    public function run($opt)
    {
        $qid = intval($opt['qid']);
        $uid = intval($opt['uid']);
        $nuid = intval($opt['nuid']);
        $field = trim($opt['field']);
        $optimal = trim($opt['optimal']);
        $page = intval($opt['page']);
        $sort = trim($opt['sort']);
        $num = empty($opt['num']) ? 15 : intval($opt['num']);
        $startrow  = intval($opt['startrow']);
        if ($optimal <> '') {
            $map['optimal'] = intval($optimal);
        }
        if (!empty($qid)) {
            $map['qid'] = $qid;
        }
        if (!empty($uid)) {
            $map['uid'] = $uid;
        }
        $nuid = session('ytata.uid');
        if (!empty($nuid) && empty($uid)) {
            $map['uid'] = array('NEQ', $nuid);
        }
        $li = D('Answer')->get_list($map, $page, $sort, $num, $startrow);
        return $li;
    }


}

?>